<template>
  <el-button type="primary"
             icon="el-icon-sort"
             @click="getOption">服务端加载</el-button>
  <br /> <br />
  <avue-crud :key="reload"
             :data="data"
             :option="option"
             :table-loading="loading"></avue-crud>
</template>
<script>
export default {
  data () {
    return {
      reload: Math.random(),
      loading: true,
      data: [],
      option: {},
    };
  },
  methods: {
    getOption () {
      this.$message.success('模拟2s后服务端动态加载');
      setTimeout(() => {
        this.option = {
          border: true,
          align: 'center',
          menuAlign: 'center',
          column: [
            {
              label: '姓名',
              prop: 'name'
            }, {
              label: '性别',
              prop: 'sex'
            }, {
              label: '省份',
              prop: 'province',
              type: 'select',
              props: {
                label: 'name',
                value: 'code'
              },
              dicUrl: `https://cli.avuejs.com/api/area/getProvince`,
              rules: [
                {
                  required: true,
                  message: '请选择省份',
                  trigger: 'blur'
                }
              ]
            }]
        }
        this.data = [
          {
            name: '张三',
            sex: '男',
            province: '110000'
          }, {
            name: '李四',
            sex: '女',
            province: '120000'
          }
        ]
        this.loading = false;
        this.reload = Math.random()
      }, 2000)

    }
  }
}
</script>

```
:::